package com.bw.zg3park2212.mem

import androidx.lifecycle.MutableLiveData
import com.bw.base.entity.MemAddParam
import com.bw.base.entity.MemEntity
import com.bw.base.entity.MenberEntity
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class MemViewModel  @Inject constructor(val apiService: ApiService): BaseViewModel(){
    var memaddSuccse=MutableLiveData<MemEntity>()
    fun memadd(memAddParam: MemAddParam){
        httpRequst2(
            {apiService.getmemadd(memAddParam)},
            memaddSuccse::postValue
        )
    }
    var memSuccse=MutableLiveData<MemEntity>()
    fun mem(userId:Int){
        httpRequst2(
            {apiService.getmem(userId)},
            memSuccse::postValue)
    }
    var memupSuccse=MutableLiveData<MemEntity>()
    fun memup(userId:Int,newMembershipLevel: String){
        httpRequst2(
            {apiService.getmemup(userId,newMembershipLevel)},
            memupSuccse::postValue)
    }
    var menberSuccse=MutableLiveData<MenberEntity>()
    fun menber(userId:Int){
        httpRequst2(
            {apiService.getmenber(userId)},
            menberSuccse::postValue)
    }
}